#import "RNEditItemBackgroundRoundedBottom.h"
#import "RNConstants.h"

@implementation RNEditItemBackgroundRoundedBottom

-(void)drawRect:(NSRect)frame {
    frame = [self bounds];
    CGFloat frameWidth = NSWidth(frame);
    CGFloat frameHeight = NSHeight(frame);
    NSBezierPath *path = [NSBezierPath bezierPath];
    
    [path moveToPoint:NSMakePoint(frame.origin.x, frameHeight)];
    [path lineToPoint:NSMakePoint(frame.origin.x, RNDetailViewCellCornerRadius)];
    [path appendBezierPathWithArcFromPoint:frame.origin toPoint:NSMakePoint(RNDetailViewCellCornerRadius, frame.origin.y) radius:RNDetailViewCellCornerRadius];
    [path lineToPoint:NSMakePoint(frameWidth - RNDetailViewCellCornerRadius, frame.origin.y)];
    [path appendBezierPathWithArcFromPoint:NSMakePoint(frameWidth, frame.origin.y) toPoint:NSMakePoint(frameWidth, RNDetailViewCellCornerRadius) radius:RNDetailViewCellCornerRadius];
    [path lineToPoint:NSMakePoint(frameWidth, frameHeight)];
    [path closePath];
    
    [[self backgroundColor] setFill];
    [path fill];
}

@end
